<!DOCTYPE html>
<html>
    <head>
        <title></title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link type="text/css" rel="stylesheet" href="../../resource/css/reset.css"/>
        <link type="text/css" rel="stylesheet" href="../../resource/css/api_index.css"/>
        <script type="text/javascript" src="../../resource/js/fw/jquery-1.8.3.min.js"></script>
    </head>
    <body>
        <div class="pk-wrap">

            <div class="pk-unit-wrap">
                <div class="pk-unit">
                    <h1 class="clearfix">
                        <span class="pk-color-title">Arguments.length</span>
                        <span class="pk-float-right pk-tip">Core > Object > Arguments > length</span>
                    </h1>
                </div>
                <div class="pk-unit">
                    <div class="pk-unit-with-style">
                        <div class="pk-unit-tag">Description</div>
                        <pre>    传递给函数的参数个数。
    Arguments对象的length属性表示传给当前函数的参数个数。该属性只定义在函数体中。注意该属性表示的是实际传人的参数个数，而不是声明的参数个数。声明的参数个数请参阅Function.length。同时要留意该属性没有任何Array.length属性的特殊行为。</pre>
                    </div>
                </div>
            </div>

            
            
            
            
                        <div class="pk-unit-wrap">
                <div class="pk-unit">
                    <h1 class="clearfix">
                        <span class="pk-color-title pk-italic">代码示例</span>
                    </h1>
                </div>
                <div class="pk-unit">
                    <div class="pk-unit-with-style pk-code">
                        <div class="pk-unit-tag">
                            <span>Code</span>
                        </div>
                        <div class="pk-unit-fns">
                            <a href="javascript:" title="Fold or unfold the code" data-rel="fold-btn">-Fold</a>
                            <a href="javascript:" data-rel="copy-code">Copy</a>
                        </div>
                        <pre>//使用Arguments对象来检查传人参数个数的正确性
<span class="pk-code-key">function</span> check(args){
    <span class="pk-code-key">var</span> actual=args.length;         //实际的参数个数
    <span class="pk-code-key">var</span> expected=args.callee.length;//期待的参数个数
    <span class="pk-code-key">if</span> (actual !=expected){         //如果不相等,则抛出异常
        <span class="pk-code-key">throw</span> <span class="pk-code-key">new</span> Error("参数个数有误：期望值："+expected+";实际值："+actual);
    }
}
//演示如何使用check()方法的示例函数
<span class="pk-code-key">function</span> f(x,y,z){
    check(arguments); //检查参数个数的正确性
    <span class="pk-code-key">return</span> x+y+z;  //正常执行该函数的剩余代码
}</pre>
                    </div>
                </div>
            </div>

            <script type="text/javascript" src="../../resource/js/fw/clipboard/ZeroClipboard.min.js"></script>
            <script type="text/javascript" src="../../resource/js/api_index.js"></script>
            <script type="text/javascript">
                if(window.clipboardData){
                    $('a[data-rel="copy-code"]').click(function(){
                        window.clipboardData.setData('text',$(this).parent().next().text());
                        alert("Copy successfully!");
                    });
                }else{
                    clipboard($('a[data-rel="copy-code"]'),"../../resource/js/fw/clipboard/ZeroClipboard.swf");
                }
            </script>
                    </div>
    </body>
</html>
